import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { BrowserModule } from '@angular/platform-browser';
// 登录，注册，密码重置，账号开通页
import { LoginPage } from './pages/login/login.page';
import { RegPage } from './pages/reg/reg.page';
import { ForgetPage } from './pages/forget/forget.page';
import { InfoPage } from './pages/info/info.page';


// pages
import { DashboradPage } from './pages/dashborad/dashborad.page';

import { WordPage } from './pages/word/word.page';

import { WordDetailPage } from './pages/word.detail/word.detail';

import { MonitorPage } from './pages/monitor/monitor.page';

import { BrandDetailPage } from './pages/brand.detail/brand.detail.page';

import { ShopDetailPage } from './pages/shop.detail/shop.detail.page';

import { ProductDetailPage } from './pages/product.detail/product.detail.page';

import { QuestionPage } from './pages/question/question.page'
import { CustomPage } from './pages/custom/custom.page';
import { SettingPage } from './pages/setting/setting.page';

//产品功能
import { AttrComponent } from './pages/attr/attr.component';
import { ShopComponent } from './pages/shop/shop.component';
import { ProductComponent } from './pages/product/product.component';
import { BrandComponent } from './pages/brand/brand.component';

// 监控
import { MonitorBrandPage } from './pages/monitor.brand/monitor.brand.page';
import { MonitorShopPage } from './pages/monitor.shop/monitor.shop.page';
import { MonitorProductPage } from './pages/monitor.product/monitor.product.page';

//直播
import { LivePage } from './pages/live/live.page';;
import { PersonLive } from './pages/live/person/person.live';
import { LiveShopHistory } from './pages/live/live.shop.history/live.shop.history';

import { AuthGuard } from './utils/authGuard';



// pages
export const routingPages = [DashboradPage, WordPage, WordDetailPage, ShopComponent, BrandComponent, ProductComponent, AttrComponent, MonitorPage, MonitorShopPage, MonitorBrandPage, MonitorProductPage, LoginPage, RegPage, ForgetPage, InfoPage, BrandDetailPage, ShopDetailPage, ProductDetailPage, QuestionPage, CustomPage, SettingPage, LivePage, PersonLive, LiveShopHistory];


// dashborad children

import { DashboradPie } from './pages/dashborad/category/pie.component';

import { DashBoradTopList } from './pages/dashborad/list/dashborad.list';
import { DashboradBrand } from './pages/dashborad/list/brand/brand.component';
import { DashboradShop } from './pages/dashborad/list/shop/shop.component';
import { DashboradAddComponent } from './pages/dashborad/add/dashborad.add';
import { DoubleDashProductComponent } from './pages/dashborad/double.product/double.dash.product';
import { DashboradSellComponent } from './pages/dashborad/sell/dashborad.sell';
import { DashboradHistory } from './pages/dashborad/sell/dashborad.history/dashborad.history';
import { DashboradMonthHistory } from './pages/dashborad/sell/dashborad.month.history/dashborad.month.history';


import { MonitorBrandComponent } from './pages/monitor/brand/monitor.brand.component';
import { MonitorShopComponent } from './pages/monitor/shop/monitor.shop.component';
import { MonitorProductComponent } from './pages/monitor/product/monitor.product.compoenent';
import { MonitorAddComponent } from './pages/monitor/add/monitor.add.component';

import { BrandSellComponent } from './pages/brand.detail/sell/brand.sell';
import { BrandProductComponent } from './pages/brand.detail/product/brand.product';
import { DoubleBrandProductComponent } from './pages/brand.detail/double.product/double.brand.product';
import { BrandShopComponent } from './pages/brand.detail/shop/brand.shop';
import { BrandHistoryComponent } from './pages/brand.detail/sell/brand.history/brand.history';
import { BrandPieComponent } from './pages/brand.detail/category/brand.pie';
import { BrandMonthHistoryComponent } from './pages/brand.detail/sell/brand.month.history/brand.month.history';


import { ShopProductComponent } from './pages/shop.detail/product/shop.product';
import { ShopSellComponent } from './pages/shop.detail/sell/shop.sell';
import { ShopHistoryComponent } from './pages/shop.detail/sell/shop.history/shop.history';
import { ShopMonthHistoryComponent } from './pages/shop.detail/sell/shop.month.history/shop.month.history';
import { ShopPieComponent } from './pages/shop.detail/category/shop.pie';
import { ShopBrandComponent } from './pages/shop.detail/brand/shop.brand';
import { DoubleShopProductComponent } from './pages/shop.detail/double.product/double.shop.product';


// product
import { ProductSellComponent } from './pages/product.detail/sell/product.sell';
import { ProductHistoryCompoenet } from './pages/product.detail/sell/product.history/product.history';
import { ProductMonthHistoryCompoenet } from './pages/product.detail/sell/product.month.history/product.month.history';

// attr
import {AttrPoolComponent} from './pages/attr/pool/attr.pool.component';
import {AttrProductComponent} from './pages/attr/product/attr.product';
import {AttrSellComponent} from './pages/attr/sell/attr.sell';




// 淘宝直播components
import { LiveHistoryComponent } from './pages/live/live.history/live.history';
import { LiveCatComponent } from './pages/live/live.cat/live.cat';
import { LiveShopComponent } from './pages/live/live.shop/live.shop';


import { WordDetailHistoryComponent } from './pages/word.detail/word.history/word.history';
import { WordDetailProductComponent } from './pages/word.detail/word.product/word.product';

// chilren
export const routingPagesComponents = [
  // dashborad

  DashboradPie,

  DashBoradTopList,
  DashboradBrand,
  DashboradShop,

  DashboradAddComponent,

  DashboradSellComponent,
  DashboradHistory,
  DashboradMonthHistory,
  DoubleDashProductComponent,


  MonitorBrandComponent,
  MonitorShopComponent,
  MonitorProductComponent,
  MonitorAddComponent,


  BrandSellComponent,
  BrandProductComponent,
  DoubleBrandProductComponent,
  BrandShopComponent,
  BrandHistoryComponent,
  BrandPieComponent,
  BrandMonthHistoryComponent,

  ShopProductComponent,
  ShopSellComponent,
  ShopHistoryComponent,
  ShopMonthHistoryComponent,
  ShopPieComponent,
  ShopBrandComponent,
  DoubleShopProductComponent,

  ProductSellComponent,
  ProductHistoryCompoenet,
  ProductMonthHistoryCompoenet,

  AttrPoolComponent,
  AttrProductComponent,
  AttrSellComponent,

  LiveHistoryComponent,
  LiveCatComponent,
  LiveShopComponent,

  WordDetailHistoryComponent,
  WordDetailProductComponent
];



const routes: Routes = [
  // 行业分析
  {
    path: 'dashborad', component: DashboradPage, canActivate: [AuthGuard]
    , children: [
      { path: '', redirectTo: "sell", pathMatch: 'full' },
      { path: 'sell', component: DashboradSellComponent },
      { path: 'category', component: DashboradPie },
      { path: 'list', component: DashBoradTopList },
      { path: 'doubleProduct', component: DoubleDashProductComponent },
      { path: '**', redirectTo: "sell" }
    ]
  },

  // 词云
  { path: 'word', component: WordPage, canActivate: [AuthGuard] },
  { path: 'word/:words', component: WordDetailPage, canActivate: [AuthGuard]
    , children: [
      { path: 'sell', component: WordDetailHistoryComponent },
      // { path: 'category', component: BrandPieComponent },
      // { path: 'shop', component: BrandShopComponent },
      { path: 'product', component: WordDetailProductComponent },
      // { path: 'doubleProduct', component: DoubleBrandProductComponent },
      { path: '**', redirectTo: "sell" }
    ]

  },

  // 监控
  { path: 'monitor', component: MonitorPage, canActivate: [AuthGuard] },//总监控
  { path: 'monitorProduct', component: MonitorProductPage, canActivate: [AuthGuard] },
  { path: 'monitorBrand', component: MonitorBrandPage, canActivate: [AuthGuard] },
  { path: 'monitorShop', component: MonitorShopPage, canActivate: [AuthGuard] },

  // 监控详情
  {
    path: 'monitorBrand/:brandName', component: BrandDetailPage, canActivate: [AuthGuard]
    , children: [
      { path: 'sell', component: BrandSellComponent },
      { path: 'category', component: BrandPieComponent },
      { path: 'shop', component: BrandShopComponent },
      { path: 'product', component: BrandProductComponent },
      { path: 'doubleProduct', component: DoubleBrandProductComponent },
      { path: '**', redirectTo: "sell" }
    ]
  },
  { path: 'monitorProduct/:numberId', component: ProductDetailPage, canActivate: [AuthGuard] },
  {
    path: 'monitorShop/:uid', component: ShopDetailPage, canActivate: [AuthGuard]
    , children: [
      { path: 'sell', component: ShopSellComponent },
      { path: 'category', component: ShopPieComponent },
      { path: 'brand', component: ShopBrandComponent },
      { path: 'product', component: ShopProductComponent },
      { path: 'doubleProduct', component: DoubleShopProductComponent },
      { path: '**', redirectTo: "sell" }
    ]

  },

  // 基础数据
  { path: 'brand', component: BrandComponent, canActivate: [AuthGuard] },
  { path: 'product', component: ProductComponent, canActivate: [AuthGuard] },
  { path: 'shop', component: ShopComponent, canActivate: [AuthGuard] },

  // 基础详情
  { path: 'brand/:brandName', component: BrandDetailPage, canActivate: [AuthGuard] },
  { path: 'product/:numberId', component: ProductDetailPage, canActivate: [AuthGuard] },
  { path: 'shop/:uid', component: ShopDetailPage, canActivate: [AuthGuard] },

  // 淘宝直播
  { path: 'live', component: LivePage, canActivate: [AuthGuard] },
  { path: 'live/:darenId', component: PersonLive, canActivate: [AuthGuard] },
  { path: 'live/:darenId/:uid', component: LiveShopHistory, canActivate: [AuthGuard] },

  // 属性
  { path: 'attr', component: AttrComponent, canActivate: [AuthGuard] },

  { path: 'setting', component: SettingPage, canActivate: [AuthGuard] },
  { path: 'question', component: QuestionPage, canActivate: [AuthGuard] },
  { path: 'custom', component: CustomPage, canActivate: [AuthGuard] },
  { path: 'login', component: LoginPage },
  { path: 'reg', component: RegPage },
  { path: 'forget', component: ForgetPage },
  { path: 'info', component: InfoPage },
  { path: '', redirectTo: "/dashborad", pathMatch: 'full' },
  { path: '**', redirectTo: "/dashborad" }
];

@NgModule({
  imports: [BrowserModule,BrowserAnimationsModule,RouterModule.forRoot(routes)],
  exports: [RouterModule],
  providers: [AuthGuard]
})
export class AppRoutingModule { }
